package com.ideafactory.client.ybservice.ybviewpager;

import android.content.Context;
import android.view.View;

/**
 * Created by LiuShao on 2016/5/24.
 */
public abstract  class GoodsBasePager {
    private View view;
    public Context context;

    public abstract View initView();//初始化界面用，子类可直接继承

    public View getRootView(){
        return view;//拿到根view
    }

    /**
     * @param orignPosition 从哪个页面过来的
     */
    public abstract void initData(int orignPosition);
    public abstract void initViewBuind();

    public GoodsBasePager(Context context){
        this.context = context;
        view = initView();//拿到实例化的view
        initViewBuind();
    }

    public interface onPagerChange{
        void changePositon(int FROM,int TO);
    }
    public static void setOnPagerChange(GoodsBasePager.onPagerChange onPagerChange) {
        GoodsBasePager.onPagerChange = onPagerChange;
    }
    public static onPagerChange onPagerChange;


    public static final int MAIN_FRAGMENT = -1;
    public static final int GOODS_DETIAL_INT = 0;
    public static final int GOODS_ENSURE_INT = 1;
    public static final int GOODS_PAY_INT = 2;
    public static final int GOODS_PAY_SCUESS_INT = 3;

    private static int key;
    private static Object obj;

    public static void setObj(int key,Object obj) {
        GoodsBasePager.key = key;
        GoodsBasePager.obj = obj;
    }

    public static int mCurrentPosition = -1;

    public static Object getObj(int kkk) {
        if (kkk==key) {
            return obj;
        } else {
            return null;
        }
    }

    public static void clearObj(){
        obj = null;
    }

}
